package com.mycjj.android.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ListView;

import com.mycjj.android.R;
import com.mycjj.android.adapter.MainTabAdapter;
import com.mycjj.android.pullrefresh.PullToRefreshBase;
import com.mycjj.android.pullrefresh.PullToRefreshBase.OnRefreshListener;
import com.mycjj.android.pullrefresh.PullToRefreshListView;

/**
 * 新车
 * @author mark
 *
 */
public class PointCFragment extends BaseFragment{
	
	public static PointCFragment newInstance(String type) {
		PointCFragment fragment = new PointCFragment();
		Bundle bundle = new Bundle();
		bundle.putString("type", type);
		fragment.setArguments(bundle);
        return fragment;
    }
	private View rootView;
	private PullToRefreshListView mListView;
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		rootView = inflater.inflate(R.layout.fragment_main_new_car, null);
		mListView = (PullToRefreshListView)rootView.findViewById(R.id.lv_pull_refresh_list);
		mListView.setOnRefreshListener(new OnRefreshListener<ListView>() {
			@Override
			public void onRefresh(PullToRefreshBase<ListView> refreshView) {
				//请求数据
				mListView.onRefreshComplete();//归原来
			}
		});
		return rootView;
	}
	private MainTabAdapter adapter;
	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		initData();
	}
	
	private void initData(){
		adapter = new MainTabAdapter(getActivity());
		mListView.setAdapter(adapter);
	}
}
